-- $Id: xpa-net-tcp.ads,v 1.7 2005-12-24 16:40:30 bacon Exp $

with gnat.sockets.thin;
with interfaces.c;
with xpa.net.sck;

package xpa.net.tcp is

	type tcp_type is private;
	type tcp_access is access all tcp_type;
	type tcp_mode is (text, binary);

	procedure open (tcp: in out tcp_access; mode: in tcp_mode);
	procedure close (tcp: in out tcp_access);

	procedure connect (tcp: in out tcp_access);

	procedure read (tcp: in out tcp_access; 
		data: out byte_array; last: out offset);
	procedure read (tcp: in out tcp_access; 
		data: out str; last: out natural);
	procedure write (tcp: in out tcp_access);

private
	type buffer_type is array(1..3000) of char;

	type tcp_type is
	record
		handle: interfaces.c.int;
		mode: tcp_mode;
		buffer: buffer_type;
		dynamic: boolean;
	end record;

end xpa.net.tcp;
